A viscoelastic shear zone model of compressional and extensional plate boundaries