     @IBOutlet var containerImageView: UIImageView!
     @IBOutlet var overlayImageView: UIImageView!
     @IBOutlet var tapGesture: UITapGestureRecognizer!
+    var applied = false
+    var transform: CATransform3D!
 
     override func viewDidLoad() {
         super.viewDidLoad()
+        overlayImageView.center = containerImageView.center
         applyTranformation()
     }
 
     @IBAction func didTap(_ sender: UITapGestureRecognizer) {
         UIView.animate(withDuration: 0.5) {
-            self.overlayImageView.layer.transform = CATransform3DIdentity
+            self.toggleTransform()
         }
     }
 
-    func applyTranformation() {
+    func toggleTransform() {
+        applied = !applied
+        if applied {
+            overlayImageView.layer.transform = CATransform3DIdentity
+        } else {
+            applyTranformation()
+        }
+    }
+
+    func tranformation() -> CATransform3D {
         let start = Perspective(overlayImageView.frame)
         let transform = FittingPolygon.loadFromSvgFile()
         var destination = Perspective(overlayImageView.frame)
         print("transform.points:", transform.points)
         destination = Perspective(transform.points)
-        overlayImageView.layer.transform = start.projectiveTransform(destination: destination)
+        return start.projectiveTransform(destination: destination)
+    }
+
+    func applyTranformation() {
+        overlayImageView.layer.transform = tranformation()
     }
 
 }

            points.append(CGPoint(x: x, y: y))
        }
        assert(points.count == 4, "should have 4 point")
    }

    class func loadFromSvgFile() -> FittingPolygon {

                qualifiedName qName: String?,
                attributes attributeDict: [String : String] = [:]) {
        if elementName == "polygon" {
            pointString = attributeDict["points"]?.trimmingCharacters(in: .whitespacesAndNewlines)
        }
    }
}
