For example
In matlab, we use tform = [affine2d([cosd(10) sind(10) 0;-sind(10) cosd(10) 0; 0 0 1])] to rotate image 10 degrees cw then use imwarp to create the new rotated image that fills with black pixels.
How to crop the area in the red rectangle?
note: the red rectangle added manually.