I would like to adjust the location of a node on a path automatically when there is a coordinate transformation on the path. In the example below, I cheated and manually adjusted the location of the nodes.

**MWE:**

```
\documentclass[]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\def \rotationangle {120};

%Line without a rotation
\begin{scope}[rotate=0];
   \draw(0,0) -- (5cm,0)
   node[at start, left]{a}
   node[at end, right]{b}
   node[midway, above]{\tiny a) Unrotated};
\end{scope}

%Line with a rotation, but nodes are not aligned with line axis
\begin{scope}[yshift=1cm, rotate=\rotationangle];
   \draw(0,0) -- (5cm,0)
   node[at start, left]{a}
   node[at end, right]{b}
   node[midway]{\tiny b)Rotated, but nodes are not aligned};
\end{scope}

%Line with rotation, nodes are aligned with line axis with a cheat.
%Can the nodes be aligned with w.r.t. the rotation automatically. 
\begin{scope}[yshift=1cm, , xshift=5cm,  rotate=\rotationangle];
   \draw(0,0) -- (5cm,0)
   node[at start, xshift=0.15cm, yshift=-0.2cm]{a}   %Cheated with xshift and yshift
   node[at end, xshift=-0.35cm, yshift=0.25cm, anchor=west]{b} %Cheated with xshift and yshift
   node[midway]{\tiny c)Rotated, nodes are aligned, but cheated};   
\end{scope}

\end{tikzpicture}
\end{document}

```

**Output:**

[![enter image description here](https://i.stack.imgur.com/DRzyT.png)](https://i.stack.imgur.com/DRzyT.png)

I can write a code to make the adjustment with for example, tikzmath, and make it automated. However, I wonder if there is a built-in-Tikz way of doing this.