Position mesh to fill viewport width

This thread is somewhat related. It solves the opposite problem, though:

For your case, it might be important to know the possible situations, because in some cases you might need not only to reposition your cubes, but also to rotate them as a group. See an illustration: