Sloped Tikz node with rotation and scale

Use nodes={rotate=<angle>} instead transform shape:

In contrast to transform shape the nodes={rotate=<angle>} passes only the transformation selected by its argument (i.e. rotate=<angle>) to all nodes inside the scope.

Defining a new style myrotate as an abbreviation

\tikzset{
  myrotate/.style={rotate=#1,nodes={rotate=#1}}
}

and using myrotate=<angle> instead rotate=<angle> results in

enter image description here

Code:

\documentclass{article}
\usepackage{tikz}
\tikzset{
  myrotate/.style={rotate=#1,nodes={rotate=#1}}
}

\newcommand*{\MyDraw}[1]{%
    \draw [ultra thick, -latex] (0,0) -- (1,4) 
        node [midway, above, sloped, align=center] {#1};
}%

\begin{document}
\begin{tikzpicture}
    \MyDraw{not rotated};
\end{tikzpicture}%
% --------------------------------- apply "rotation"
\begin{tikzpicture}
    \begin{scope}[myrotate=-25,red]
        \MyDraw{rotated};
    \end{scope}
\end{tikzpicture}%
% --------------------------------- apply "rotation" and "scale"
\begin{tikzpicture}
    \begin{scope}[myrotate=-15,scale=1.3, blue]
        \MyDraw{rotated and scaled};
    \end{scope}
\end{tikzpicture}%
% --------------------------------- apply "rotation", "scale" and "transform shape"
\begin{tikzpicture}
    \begin{scope}[myrotate=-15, scale=1.5, orange]
        \MyDraw{rotated, scaled and \\ ``transform shape"};
    \end{scope}
\end{tikzpicture}
\end{document}

I used to write a linear algebra library for TikZ(mainly to handle complex numbers) but since now TikZ is using Lua extensively that became pretty much obsolete so I stopped it. Nevertheless here is a quick steal from the Givens QR decomposition for two by two matrix that separates the transformation matrix into scaling and rotation and we only use rotation part and omit the scale/slant part.

Same idea can be used to cancel the rotation and keep the scaling to answer the question in the comments. I'll have a look if I can spare more time.

\documentclass{article}
\usepackage{tikz}

\newcommand*{\MyDraw}[1]{%
    \draw [ultra thick, -latex] (0,0) -- (1,4) 
        node [midway, above, sloped, align=center,cancel scale] {#1};
}%
\tikzset{cancel scale/.code=\pgfmathcancelscale}

\makeatletter
\def\pgfmathcancelscale{%
  \pgfgettransformentries{\my@a}{\my@b}{\my@c}{\my@d}{\my@xi}{\my@yi}%
  \pgfmathsetmacro\my@cos{\my@a/veclen(\my@a,\my@c)}%
  \pgfmathsetmacro\my@sin{-\my@c/veclen(\my@a,\my@c)}%
  \pgfsettransformentries{\my@cos}{\my@sin}{-\my@sin}{\my@cos}{\my@xi}{\my@yi}%
}
\makeatother

\begin{document}

\begin{tikzpicture}
    \begin{scope}[rotate=-15, scale=1.5, transform shape, orange]
        \MyDraw{rotated, scaled and \\ ``transform shape"};
            \begin{scope}[rotate=40, scale=0.2, shift={(10cm,-5cm)},transform shape, blue]
            \MyDraw{rotated, scaled and \\ ``transform shape"};
            \end{scope}
    \end{scope}
\end{tikzpicture}
\end{document}

enter image description here


As a follow up to my comment, here is what I have tried using this answer from the question Access the scale option within TikZ environment.

I would define a new key Sloped that guess the xscale and yscale factor to cancel scaling while using sloped and transform shape to keep the rotation:

\tikzset{
  Sloped/.code=%
  \pgfgettransformentries{\mya}{\myb}{\myc}{\myd}{\mys}{\myt}%
  \tikzset{sloped, transform shape, xscale=1/\mya, yscale=1/\myd}%  
}

Code

\documentclass[margin=0.5cm]{standalone}
\usepackage{tikz}

\tikzset{%
  Sloped/.code=%
  \pgfgettransformentries{\mya}{\myb}{\myc}{\myd}{\mys}{\myt}%
  \tikzset{sloped, transform shape, xscale=1/\mya, yscale=1/\myd}%  
}%

\newcommand*{\MyDraw}[1]{%
    \draw [ultra thick, -latex] (0,0) -- (70:5) 
        node [midway, above, Sloped, align=center] {#1};
}%

\begin{document}
  \begin{tikzpicture}
      \MyDraw{not rotated};
  \end{tikzpicture}%
  %--------------------------------- apply "rotation"
  \begin{tikzpicture}
      \begin{scope}[rotate=-25, red]
          \MyDraw{rotated};
      \end{scope}
  \end{tikzpicture}%
  % --------------------------------- apply "rotation" and "scale"
  \begin{tikzpicture}
      \begin{scope}[rotate=-15, scale=1.3, blue]
          \MyDraw{rotated and scaled};
      \end{scope}
  \end{tikzpicture}%
  % --------------------------------- apply "rotation", "scale" and "transform shape"
  \begin{tikzpicture}
      \begin{scope}[rotate=-15, scale=1.5, transform shape, orange]
          \MyDraw{rotated, scaled and \\ ``transform shape"};
      \end{scope}
  \end{tikzpicture}
\end{document}

Output

Output

Problem

As mentioned by Peter Grill in the comment, it doesn't work very well, the text is a bit smaller. I remove my answer as soon as someone tell me why it doesn't work ;-)

Problem comparing with the exact output