Measurement of the muon momentum in pion decay at rest using a surface muon beam