title: How can I remove all SVG elements which do not intersect a particular rectangle?
body: <p>I have an SVG image from which I'd like to extract several rectangular regions as independent SVG images. Because the original image is rather large but the elements intersecting the areas of interest are small, I do not want elements which lie entirely outside the cropped <code>viewBox</code> to remain in the cropped SVG image.</p>
  
  <p>Conceptually, what I'm looking for is this:</p>
  
  <p><img src="https://i.stack.imgur.com/HLmgz.png" alt="cropping diagram"></p>
  
  <p>The cropped SVG (yes, the output must be <em>SVG</em>, not a bitmap) should not contain elements for the spiral or the star, as they fall entirely outside the area of interest. (Yes, the nonintersecting elements really must be removed, due to the source SVG being several orders of magnitude more bytes than the cropped SVG, as I intend to crop the source in different ways hundreds of times.) I want to be able to specify the area of interest on the command-line, as well, due to having quite a number of such cropped images to produce.</p>
  
  <p>Are there any tools which can do this?</p>