title: Subtract CGRect from CGRect -- largest piece of one not containing the other
body: <p>How I can substract one <code>CGRect</code> from another? I want the result <code>R1 - R2</code> to be the largest subrectangle of R1 that does not intersect R2.</p>
  
  <p><strong>Example 1</strong>:</p>
  
  <pre>
  +----------------------------------+
  | +--------+                       |
  | |   R2   |                       |
  | |        |                       |
  | +--------+      R1               |
  |                                  |
  |                                  |
  |                                  |
  +----------------------------------+
  </pre>
  
  <p>R3 = CGRectSubstract(R2,R1);</p>
  
  <pre>
              +----------------------+
              |                      |
              |                      |
              |                      |
              |          R3          |
              |                      |
              |                      |
              |                      |
              +----------------------+
  </pre>
  
  <p><strong>Example 2</strong>:</p>
  
  <pre>
  +-----------------------+----------+
  |                       |          |
  |                       |    R2    |
  |                       |          |
  |                 R1    +----------+
  |                                  |
  |                                  |
  |                                  |
  +----------------------------------+
  </pre>
  
  <p>R3 = CGRectSubstract(R2,R1);</p>
  
  <pre>
  +-----------------------+
  |                       |
  |                       |
  |                       |
  |          R3           |
  |                       |
  |                       |
  |                       |
  +-----------------------+
  </pre>
  
  <p><strong>Example 3</strong>:</p>
  
  <pre>
  +----------------------------------+
  |                                  |
  |                                  |
  |                                  |
  |                 R1               |
  |         +---------+              |
  |         |         |              |
  |         |   R2    |              |
  +---------+---------+--------------+
  </pre>
  
  <p>R3 = CGRectSubstract(R2,R1);</p>
  
  <pre>
  +----------------------------------+
  |                                  |
  |                                  |
  |              R3                  |
  |                                  |
  +----------------------------------+
  
  
  
  </pre>