This is what I want to achieve:
https://i.stack.imgur.com/O3rRl.png
The problem with the transform() function is that it keeps the ratio between the sides of the image and cant skew the corners independently.
This is what I have in mind:
function draw(a,b,c,d,img) {
//witchcraft goes here
}
where a,b,c,d are the corners and img is the image. The function draws the image in the polygon that the corners create.