I would be grateful to know how to:
- fix the code to make it work
- be able to control the viewing angle so that I can see the rectangle like the top surface of this image
\documentclass{article}
\usepackage{tikz-3dplot}
\usetikzlibrary{perspective,calc,3d,arrows}
\begin{document}
\tdplotsetmaincoords{70}{110} % Set the view angles
\begin{tikzpicture}[scale=2, transform shape, tdplot_main_coords]
% Define the coordinates of the rectangle corners with labels
\coordinate (A) at (0,0,0);
\coordinate (B) at (4,0,0);
\coordinate (C) at (4,1,0);
\coordinate (D) at (0,1,0);
% Draw the rectangle
\draw (A) -- (B) -- (C) -- (D) -- cycle;
% Draw x-axis
\draw[->] (0,0,0) -- (2,0,0) node[anchor=north east]{$x$};
% Draw y-axis
\draw[->] (0,0,0) -- (0,2,0) node[anchor=north west]{$y$};
% Draw z-axis
\draw[->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
% Add labels to coordinates
\node[above right] at (A) {$A$};
\node[above right] at (B) {$B$};
\node[above right] at (C) {$C$};
\node[above right] at (D) {$D$};
\end{tikzpicture}
\end{document}



