The Thermal Phase Curve Offset on Tidally and Nontidally Locked Exoplanets: A Shallow Water Model