title: SceneKit - Map cube texture to box
body: <p>I've a texture for a cube that looks like</p>
  
  <p><a href="https://i.stack.imgur.com/QwOgw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QwOgw.jpg" alt="enter image description here"></a></p>
  
  <p>I'd like to use it on a cube in a SceneKit view. I'm using the SceneKit geometry <code>SCNBox</code> for that. Unfortunately, the result is that the texture is projected entirely on each face, instead of using only the corresponding part:</p>
  
  <pre><code>let videoGeometry = SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0)
  videoGeometry.firstMaterial?.isDoubleSided = true
  videoGeometry.firstMaterial?.diffuse.contents = UIImage(named: "test")!
  </code></pre>
  
  <p>I know I can use shader modifiers on the geometry but I'm not sure where to get started. Since the texture is currently used six times, my intuition is that the <code>SCNBox</code> geometry might not be adapted to my goal, but I don't really know how to change it.</p>