PERF Improvements to rotate and transform