The code was interpreting x/y coordinates wrong sometimes and causing things to not be drawn at the correct offset. Testcase included.