Transform all grid lines for a given coordinate in one go

@Cadair - here is a first go at trying to optimize the grid drawing. I haven't had a chance to benchmark this, but could you try and measure the performance before and after for your example?