90° Self-Rotating Program
CJam, 26 25 21 bytes

WqN/":.+""\%"(~+N-~N*


Thanks to @MartinBüttner for golfing off 4 bytes!

Try it online in the CJam interpreter: original program | rotated program

This is the rotated program:

W
q
N
/
"
:
.
+
"
"
\
%
"
(
~
+
N
-
~
N
*


Idea

We can rotate the input a quarter turn clockwise by splitting it at linefeeds, reversing the order of the resulting rows, transposing rows with columns, and finally joining the rows, separated by linefeeds.

Likewise, we can rotate counterclockwise by transposing first, then reversing the rows.

Since the transposition built-in z is forbidden, we can use :.+ (reduce by vectorized character or string-character concatenation) to achieve the same effect.

:.+ is the only part of the source code that cannot be broken up. We push the strings "W%" and ":.+", conditionally reverse them if the second string contains a linefeed, concatenate, remove all linefeeds, and evaluate the result.

Code

W     e# Push -1.
qN/   e# Read all input at split it at linefeeds.
":.+" e# Push a string that, when evaluated, transposes rows and columns.
      e# As explained in the previous section, this does NOT use a built-in
      e# for matrix transposition.
"\%"  e# Push a string that, when evaluated, reverses the rows.
(~    e# Shift out the first character and evaluate it.
      e# For the original code, this evaluates '\', swapping the strings on
      e# the stack. For the rotated code, this evaluates `\n', doing nothing.
+N-   e# Concatenate and remove linefeeds.
      e# The stack now contains:   -1 input "%:.+"   or   -1 input ":.+\%"
~     e# Evaluate the string on top of the stack.
N*    e# Join the resulting array, separating by linefeeds.