There are six external ocular muscles that move the eye into what is called "the various positions of gaze". Two muscles have their primary function to turn the eye left and right. Two other muscles work the up and down positions. The last two muscles assist the other four to finely control positioning of oblique orientations such as to an angle up and left or down and right.
The eye muscle positioning system is important for a number of reasons. The eye muscles align the eyes so that each one "targets" the image exactly. They must align parallel to each other for distance viewing and turn in slightly, a process called convergence, for near vision tasks. They also compensate for head position and tilt.
In a perfect system, both eyes "target" the desired scene so that the focused image falls onto the retina at the back of the eye at "corresponding" locations. Each retinal receiving unit, called rods and cones, has a matching unit in the other eye. If the focused image falls on "corresponding" areas of each retina, the brain can use this information to perceive a stereoscopic, "3-D" image. This is part of the process which is called depth perception and provides us with an awareness of our relative position within our viewed world and knowledge of how objects in space are located relative to each other.
The angle to which the two eyes turn in (converge) signals another muscle inside the eye (ciliary muscle) to adjust the crystalline lens to focus for the target distance. For distance viewing, the eyes are aligned parallel to each other and the internal focusing system is at zero net power. When the eyes turn inwards to target an image at 40cm (16 inches), the focusing system "understands" that the degree of turning requires a focal power correction of 2.5 diopters. The focal power in diopters equals the target distance in centimeters divided into the reference number of 100cm (100/40=2.5). One of the nerves that innervates the external muscles is part of a feedback loop that communicates with the internal focusing muscles which control the crystalline lens. And the reverse is true.