title: Coordinates are not conserved after cropping fits file
body: <p>Consider the following code (download <a href="http://fits.gsfc.nasa.gov/samples/UITfuv2582gc.fits" rel="nofollow noreferrer">test.fits</a>):</p>
  
  <pre><code>from astropy.io import fits
  from photutils.utils import cutout_footprint
  
  # Read fits file.
  hdulist = fits.open('test.fits')
  hdu_data = hdulist[0].data
  hdulist.close()
  
  # Some center and box to crop
  xc, yc, xbox, ybox = 267., 280., 50., 100.
  # Crop image.
  hdu_crop = cutout_footprint(hdu_data, (xc, yc), (ybox, xbox))[0]
  # Add comment to header
  prihdr = hdulist[0].header
  prihdr['COMMENT'] = "= Cropped fits file")
  # Write cropped frame to new fits file.
  fits.writeto('crop.fits', hdu_crop, prihdr)
  </code></pre>
  
  <p>The original (left) and cropped (right) images look like this:</p>
  
  <p><a href="https://i.stack.imgur.com/tJt05.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tJt05.png" alt="enter image description here"></a></p>
  
  <p>The (ra, dec) <a href="https://en.wikipedia.org/wiki/Equatorial_coordinate_system" rel="nofollow noreferrer">equatorial coordinates</a> for the star in the center of the frame are:</p>
  
  <pre><code>Original frame: 12:10:32  +39:24:17
  Cropped frame:  12:12:07  +39:06:50
  </code></pre>
  
  <p>Why are the coordinates different in the cropped frame?</p>
  
  <hr>
  
  <p>These are the two ways to resolve this, using two different methods.</p>
  
  <pre><code>from astropy.io import fits
  from photutils.utils import cutout_footprint
  from astropy.wcs import WCS
  from astropy.nddata.utils import Cutout2D
  import datetime
  
  # Read fits file.
  hdulist = fits.open('test.fits')
  hdu = hdulist[0].data
  # Header
  hdr = hdulist[0].header
  hdulist.close()
  
  # Some center and box to crop
  xc, yc, xbox, ybox = 267., 280., 50., 100.
  
  # First method using cutout_footprint
  # Crop image.
  hdu_crop = cutout_footprint(hdu, (xc, yc), (ybox, xbox))[0]
  # Read original WCS
  wcs = WCS(hdr)
  # Cropped WCS
  wcs_cropped = wcs[yc - ybox // 2:yc + ybox // 2, xc - xbox // 2:xc + xbox // 2]
  # Update WCS in header
  hdr.update(wcs_cropped.to_header())
  # Add comment to header
  hdr['COMMENT'] = "= Cropped fits file ({}).".format(datetime.date.today())
  # Write cropped frame to new fits file.
  fits.writeto('crop.fits', hdu_crop, hdr)
  
  # Second method using Cutout2D
  # Crop image
  hdu_crop = Cutout2D(hdu, (xc, yc), (xbox, ybox), wcs=WCS(hdr))
  # Cropped WCS
  wcs_cropped = hdu_crop.wcs
  # Update WCS in header
  hdr.update(wcs_cropped.to_header())
  # Add comment to header
  hdr['COMMENT'] = "= Cropped fits file ({}).".format(datetime.date.today())
  # Write cropped frame to new fits file.
  fits.writeto('crop.fits', hdu_crop.data, hdr)
  </code></pre>