Consistently use colorTileBackground rather than "white"
Use row/col/r/c names instead of i/j where appropriate
Polish formatting of arithmetic
Simplify tile/grid size calculations

tstep is the side length of the grid cell, discounting borders
Clean up

wrap some lines, delete useless functions
Slightly abstract out x/y of svg lines