A square bounding box does not change the aspect ratio of the image.
It just says "limit the largest dimension to X px".
The 'upright' option is a failed workaround for this issue. It is
described in some documentation as limiting the height of the image,
but that it incorrect. It is still a width-based limit. If you set
'upright' to equal the aspect ratio of the image you get consistent
thumbnail sizes in a gallery, but that computation is manual and is
almost never actually done.
--scott