TransformRect

Transforms a rect by the given transform, ensuring the rect does not get inverted.