With some fiddling in matrices this could also be done live in the browser as a CSS 3D transform using matrix3d or in a WebGL context on the iframe or video element.
Have no time to do the rectifying math on the components today but basically it would be some kind of inverse of this projective transformation:
Have no time to do the rectifying math on the components today but basically it would be some kind of inverse of this projective transformation:
http://franklinta.com/2014/09/08/computing-css-matrix3d-tran...
quick non-inverse transformation adapted from http://math.stackexchange.com/a/339033/70086
http://jsfiddle.net/w4bkmeaq/