Fix various bugs along the way.
This is necessary to get the coordinates to give to the texture's `write()` method.