I went a bit wrong way with the rectangle (your shape isn't rectangle) so this doesn't overlay that well with it (I also guessed the corner points).
So I found other function and modified that for JMP. It is closer but it is still using hard-coded corner points
-Jarmo