Snapping the top-left and bottom-right corners separately can cause a rectangle to change size when offset by a subpixel amount. Instead, this patch snaps the top-left corner, then rounds the size to a whole pixel amount, so any rectangle of a given size will always have the same snapped size. Fixes #7152.