Supposing you have a rectangle (with different weight and heigh), how can you obtain the sizes of a square that, in grid order, fits perfectly within the rectangle size?
Example of a wrong square size:
Example of a perfect fit:
The images above are of a 215.9 mm x 279.4 mm (US Letter 8.5 in x 11.0 in)