On the inverse spectral problem for polygonal domains