static closestRects(rectsList1, rectsList2) {
    const result = rectsList1
      .reduce((res, rect1) => {
        const bbox1 = Geometry.toRectCoordinates(rect1);

        rectsList2.forEach((rect2) => {
          const bbox2 = Geometry.toRectCoordinates(rect2);

          const avgDistance =
            [
              Geometry.distance([bbox1.x1, bbox1.y1], [bbox2.x1, bbox1.y1]),
              Geometry.distance([bbox1.x2, bbox1.y2], [bbox2.x2, bbox1.y2]),
              Geometry.distance([bbox1.x3, bbox1.y3], [bbox2.x3, bbox1.y3]),
              Geometry.distance([bbox1.x4, bbox1.y4], [bbox2.x4, bbox2.y4]),
            ].reduce((d1, d2) => d1 + d2) / 4;

          res.push({
            distance: avgDistance,
            bbox: [Geometry.convertToRectBBox(bbox1), Geometry.convertToRectBBox(bbox2)],
          });
        });

        return res;
      }, [])
      .sort((a, b) => a.distance - b.distance);

    return result[0].bbox;
  }
Find two closes BBoxes of two lists
@param {BBox[]} rectsList1
@param {BBox[]} rectsList2