A solution to Sheil-Small's harmonic mapping problem for Jordan polygons