A vertex shader reads inputs and uniforms, does some arbitrary computations on these, and writes outputs. Vertex shader inputs are attributes passed in through vertex buffers. Vertex shader outputs are either passed as inputs to a geometry shader or directly interpolated across a primitive and used as inputs to the fragment shader.
A fragment shader reads inputs and uniforms, does some arbitrary computations of these, and writes outputs. The fragment shader inputs are values that were interpolated across the primitive for this particular sample. The fragment shader outputs are written to one or more framebuffers, in accord with the blending parameters.
If that’s too complicated, here’s a diagram:
Vertex shader Fragment shader
inputs outputs inputs outputs
position \ / gl_Position
normal >compute< lightSpaceNorm-Intp->lightSpaceNorm\ /outColor
texCoord1/ \ diffuseCoord---Intp->diffuseCoord--->compute<
Data flows from left to right. Intp stands for Interpolate.
The fragment shader cannot read vertex shader input, because that data has been consumed, processed, and discarded long before this instance of the fragment shader was activated.