We consider a continuous curve of linear elliptic formally selfadjoint differential operators of first order with smooth coefficients over a compact Riemannian manifold with boundary together with a continuous curve of global elliptic boundary conditions. We express the spectral flow of the resulting continuous family of (unbounded) selfadjoint Fredholm operators in terms of the Maslov index of two related curves of Lagrangian subspaces. One curve is given by the varying domains, the other by the Cauchy data spaces. We provide rigorous definitions of the underlying concepts of spectral theory and symplectic analysis and give a full (and surprisingly short) proof of our general spectral flow formula for the case of fixed maximal domain. As a side result, we establish local stability of weak inner unique continuation property and explain its role for parameter dependent spectral theory.