Optimize UV assignment so that it only runs once per texture.