  This paper is concerned with an inverse transmission problem for recovering
the shape of a penetrable rectangular grating sitting on a perfectly conducting
plate. We consider a general transmission problem with the coefficient
\lambda\neq 1 which covers the TM polarization case. It is proved that a
rectangular grating profile can be uniquely determined by the near-field
observation data incited by a single plane wave and measured on a line segment
above the grating. In comparision with the TE case (\lambda=1), the wave field
cannot lie in H^2 around each corner point, bringing essential difficulties in
proving uniqueness with one plane wave. Our approach relies on singularity
analysis for Helmholtz transmission problems in a right-corner domain and also
provides an alternative idea for treating the TE transmission conditions which
were considered in the authors' previous work [Inverse Problem, 39 (2023):
055004.]
