title: Rotate and Crop UIImage
body: <p>Imagine I have an UIImage.
  I need to rotate and then crop it in the global coordinate system (not UIImage coordinate system). So the resulted image will be cropped <strong>and</strong> rotated.</p>
  
  <p>How can I do this? CGImageCreateWithImageInRect will crop image only in the image-relative coordinates.  </p>
  
  <p><img src="https://i.stack.imgur.com/Zd5T3.jpg" alt="enter image description here"></p>
  
  <p>PS Answer in comments. You should use CIImage.</p>