If image is rotated we have to rotate the CGImage also
commented code