This is an idea about taking any rectangular number of grid squares on an image and warping them by solving a system of linear equations, I had previously submitted one about 3x3 but this can do mxn and to any number of dimensions... http://benpaulthurstonblog.blogspot.com/2016/04/rectangle-warping.html