Changed the resizing algorithm. It works very intuitively when it works, but is rather brittle (two notable examples: when resizing to negative width or height, it breaks the rectangle into a non-rectangular polygon, potentially self-intersecting, and it requires magic numbers that depend critically on the ordering of the points in the polygon, which was accommodated by the inclusion of some code in faux-xml "<hack>" tags in this commit).