How do I rotate with code in Unity? How do I use Quaternions?

This is how:

Vector3 myRotation = new Vector3(0f, 90f, 0f);

transform.rotation = Quaternion.Euler(myRotation);  

You can also multiply stuff.

// rotate an object 90 degrees on the Y axis
transform.rotation = transform.rotation * Quaternion.Euler(0f, 90f, 0f);  

Easy peasy.