Is there a way to transform a rectangle to a shape that is shown in the image..?
I have tried every way I can using AffineTransform to do this. But I couldn't get the the expected result. I want to make sure is this a impossible task or is there a way to do this..
Affine transformation by definition preserves points, straight lines and planes.
So you can at best transform your rectangle to a rotated parallelogram at best (Opposite lines will remain parallel).
To achieve more complex shapes, you need more general transformation like Projective transformation (also known as Homography) (affine transformation is a special kind of projective transformation).