Space--time discontinuous Galerkin finite element method with dynamic grid motion for inviscid compressible flows: I. general formulation