Fixed a rounding error when aligning rectangles to user space. Added related unit tests. Fixed issue 489.