def get_square(array, size, y, x, position=False):                 
    """ Returns an square subframe. 
    
    Parameters
    ----------
    array : array_like
        Input frame.
    size : int, odd
        Size of the subframe.
    y, x : int
        Coordinates of the center of the subframe.
    position : {False, True}, optional
        If set to True return also the coordinates of the bottom-left vertex.
        
    Returns
    -------
    array_view : array_like
        Sub array.
        
    """
    if not array.ndim==2:
        raise TypeError('Input array is not a frame or 2d array.')
    
    if size%2!=0:  size -= 1 # making it odd to get the wing
    wing = int(size/2)
    # wing is added to the sides of the subframe center. Note the +1 when 
    # closing the interval (python doesn't include the endpoint)
    array_view = array[int(y-wing):int(y+wing+1),
                       int(x-wing):int(x+wing+1)].copy()
    
    if position:
        return array_view, y-wing, x-wing
    else:
        return array_view