Paint tiles onto a grid using HTML5/canvas