Clearly after looking at the slice which is formed by cutting the rectangular prism we observe that the slicing is done perpendicular to the base such that we obtain the triangular cross section on this cake.
( if it would be done parallel to the base then we would have obtained rectangle ).
Hence, the slicing is done perpendicular to the base.