title: Crop a UIImage to use with GLKTextureLoader
body: <p>I am trying to crop an area out of a UIImage to use with GLKTextureLoader. I can set the texture directly using the the UIImage with the following:</p>
  
  <pre><code>- (void)setTextureImage:(UIImage *)image
  {
      NSError *error;
  
      texture = [GLKTextureLoader textureWithCGImage:image.CGImage options:nil error:&amp;error];
  
      if(error)
      {
          NSLog(@"Texture Error:%@", error);
      } else {
          self.textureCoordinates[0] = GLKVector2Make(1.0f, 1.0f);
          self.textureCoordinates[1] = GLKVector2Make(1.0f, 0);
          self.textureCoordinates[2] = GLKVector2Make(0, 0);
          self.textureCoordinates[3] = GLKVector2Make(0, 1.0f);
      }
  }
  </code></pre>
  
  <p>However, if I try crop the image this way:</p>
  
  <pre><code>- (void)setTextureImage:(UIImage *)image
  {
      NSError *error;
  
      CGImageRef imageRef = CGImageCreateWithImageInRect(image.CGImage, CGRectMake(0.0, 64.0f, 64.0f, 64.0f));
      texture = [GLKTextureLoader textureWithCGImage:imageRef options:nil error:&amp;error];
  
      if(error)
      {
          NSLog(@"[SF] Texture Error:%@", error);
      } else {
          self.textureCoordinates[0] = GLKVector2Make(1.0f, 1.0f);
          self.textureCoordinates[1] = GLKVector2Make(1.0f, 0);
          self.textureCoordinates[2] = GLKVector2Make(0, 0);
          self.textureCoordinates[3] = GLKVector2Make(0, 1.0f);
      }
  }
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Texture Error:Error Domain=GLKTextureLoaderErrorDomain Code=12 "The operation couldn’t be completed. (GLKTextureLoaderErrorDomain error 12.)" UserInfo=0x6a6b550 {GLKTextureLoaderErrorKey=Image decoding failed}
  </code></pre>
  
  <p>How can I take a section of the UIImage to use as a texture with GLKTextureLoader?</p>