title: iOS - Drawing Rectangles (CGRect) on UIImage in Swift not working correctly
body: <p>I am attempting to draw rectangles (array of CGRects) on a UIImage which will be rendered back to the end-user.
  The final result, for lack of a better phrase, just looks weird. For example, if I have an array of 2 CGRect's, only one is drawn, barely, but not fully complete. The other is omitted. Please see image below for how the image turns out with a particular array of CGRects. (FYI: I am sending the image to Google Cloud for processing, which responds with an array of CGRects)</p>
  
  <p>What am I missing?</p>
  
  <pre><code>private func drawOccurrencesOnImage(_ occurrences: [CGRect], _ image: UIImage) -&gt; UIImage? {
      let imageSize = image.size
      let scale: CGFloat = 0.0
      UIGraphicsBeginImageContextWithOptions(imageSize, false, scale)
  
      image.draw(at: CGPoint.zero)
      let ctx = UIGraphicsGetCurrentContext()
  
      ctx?.addRects(occurrences)
      ctx?.setStrokeColor(UIColor.red.cgColor)
      ctx?.setLineWidth(2.0)
      ctx?.strokePath()
  
      guard let drawnImage = UIGraphicsGetImageFromCurrentImageContext() else {
          presentAlert(alertTitle: "Error", alertText: "There was an issue, please try again")
          return nil
      }
  
      UIGraphicsEndImageContext()
      return drawnImage
  }
  </code></pre>
  
  <p>CGRect array ("occurrences" from function above) with a value of "[(298.0, 868.0, 65.0, 43.0), (464.0, 1017.0, 67.0, 36.0)]" results in image below:
  <img src="https://firebasestorage.googleapis.com/v0/b/can-i-park-here-ca2e1.appspot.com/o/so-img.jpg?alt=media&amp;token=72221c2f-fd2d-428d-b31d-61eda5170881" alt="Screenshot of UIImage"></p>
  
  <p>Further details: using Swift 4, iOS 12</p>
  
  <p>Thank you!</p>