Added support for non-square boxes