# How do I rotate a tikz rectangle about a specific axis?

I am trying to create a beamer animation using tikz, but I can't even get basic rotating of a tikz image working as desired.

I have a rectangle specified by

\draw[rounded corners,dotted] (-3.5,0) rectangle (-0.5,2);


I would like to rotate this rectangle about the point (-1,.5) (which is near the bottom right corner of the rectangle). I've tried:

{\rotatebox[origin=c,x=-1,y=.5]{130}{
\draw[rounded corners,dotted] (-3.5,0) rectangle (-0.5,2);}}


But this produces an error. If I just use the origin=c option, it compiles, but it rotates the rectangle about the point (0,0). I've also tried it with just the x=-1,y=.5 (without the origin option), and it fails to compile.

I have searched the documentation, which is where I learned about the options x=xdim and y=ydim. However, I can't find a single example demonstrating how these options should be used.

Any suggestions would be greatly appreciated.

Also, if there is a better command for rotating things that will be more suitable for use in a beamer animation, please let me know. Thanks!

-

TikZ has a rotate around={<angle>:<coordinate>} option:

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

Yes it is definitely the right way, even without rotate around it is possible but more complicated to obtain the same result but I think it should be avoided in most cases, rotatebox, resizebox etc. – Alain Matthes Feb 29 '12 at 6:44
+1 As usual, a brilliant answer. I notice that you usually use the standalone documentclass for demonstrating pictures- is this a convention that you adopt when producing documents too? – cmhughes Feb 29 '12 at 17:37