title: Rotate ROI in a picture
body: <p>Given the use-case, I want to rotate a ROI in a specific image. For example I have predefined bounding boxes within a image, and now the task is to rotate the part of the image inside these boxes on behalf of an angle. </p>
  
  <p>Furthermore, the rotation must be inside the bounding boxes, so the ROI is after the transformation cropped. </p>
  
  <p>I tried it with a approach of create a subimage of the bounding box, than rotate it and put it back to the original position in the source image. The problem is, that I have a huge dataset of image ( > 100.000) and I think my method probably slow down the process. </p>
  
  <p>Is there a other way to accomplish this transformation? </p>
  
  <p>Edit: For better understanding
  <a href="https://i.stack.imgur.com/ZU72O.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZU72O.jpg" alt="Original Image"></a></p>
  
  <p><strong>It is a quick mockup, how it should look after the transformation.</strong>  </p>
  
  <p><a href="https://i.stack.imgur.com/UpQ4Y.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UpQ4Y.jpg" alt="Rotatet"></a></p>