Measurement of the Z boson differential cross section in transverse momentum and rapidity in proton–proton collisions at 8 TeV