The following code: http://dpaste.com/08BT5KR
yields, a tad unexpectedly, this: http://pasteboard.co/2LOGwr5r.png
I can post this as a github issue once I get confirmation that I'm not completely misunderstanding how this is supposed to work.
// Let's hope I never have to debug/understand this again! :D
Yeah, I can see why.
Here's something though, the corner ordering is off,
it's top_right, top_left, bottom_right, bottom_left:
x2, y2, WHITE,
x1, y1, WHITE,
x3, y3, WHITE,
x4, y4, WHITE)
seems to get it right, as far as I can tell