Lets say you have two simple cubes each with their own material.

I want to combine those two meshes into a single mesh and create a new material.

How do I offset the UVs of the meshes to land where I want them to land on the new texture, given that the V value of the UV shouldn't change since the images are arranged horizontally and the U value will change depending on how many different cube textures I add?

I know how to access the UV array in a mesh using surface_get_arrays(surface_index)[Mesh.ARRAY_TEX_UV] and create a new mesh with the modified UVs. I'm just struggling to figure out the formula to offset the UVs.

I figured out what I was doing wrong. I was moving the UVs correctly. Everything looked weird because I also need to scale the UVs in the material.