We develop an index theory for symplectic differential systems, i.e., those systems of linear ODEs in R n R n * whose flow preserve the canonical symplectic form. Symplectic differential systems appear naturally in connection with solutions of Hamiltonians in symplectic manifolds. In [12] such systems were studied in association to solutions of hyper-regular Hamiltonians. Here we are interested in the case of degenerate Hamiltonians that arise - via a suitable extension of the Legendre transform - in association to constrained variational problems such as sub-Riemannian geometry and Vakonomic mechanics. All the relevant information about the geometric setup of constrained variational problems is encoded in the coefficients of the corresponding symplectic differential system. Using this formalism, we obtain by symplectic techniques a general version of the Morse index theorem for constrained variational problems, relating the second variation of the constrained Lagrangian action functional, the focal instants and the Maslov index of the solution.