I am using Vision framework to detect rectangles on images. When Vision detected any rectangle it returns four points of rectangle corners. I would like to crop this rectangle from cgImage but the main problem is how to do it when rectangle is rotated. Because in apple documentation (CGRect documentation there is no way to get rectangle by his corners. So how can I crop this rect ?
I would like to crop only selected rectangle. So I would like to get something like this
Is there any way to achieve this ?