Theory of the tilted vortex lattice in Josephson-coupled layered superconductors