Scattering theory for one-dimensional systems with nontrivial spatial asymptotics