How many squares are there?
JavaScript (ES6), 292 bytes 306 325

Edit I did the byte count totally wrong, corrected now thx http://bytesizematters.com/ correct for the last time I hope thx  Cᴏɴᴏʀ O'Bʀɪᴇɴ see https://goo.gl/LSHC1U (and 1 byte less using a literal newline insteads of '\n')

(h,z)=&gt;(o=&gt;{r=p=&gt;" ),┌(─┐┬'└│├┘┴┤┼".search(z[p]);for(q=s=0;++s&lt;o/2&amp;s&lt;h;)for(y=0;y&lt;(h-s)*o;y+=o)for(x=0;x&lt;o-s*2;q+=!n,x+=2)for(n=i=0,t=x,u=y;i&lt;=s;t+=2,u+=o,i++)n|=i&lt;s&amp;(!(r(t+y)&amp;r(t+y+s*o)&amp;1)|!(r(x+u)&amp;r(x+u+s*2)&amp;2))|i&gt;0&amp;(!(r(t+y)&amp;r(t+y+s*o)&amp;4)|!(r(x+u)&amp;r(x+u+s*2)&amp;8))})(-~z.search`
`)|q


Longer than I expected (probably a few more byte can be shaved off)

All possible squares are checked and counted.  

The r function map each character to a bitmap having


1 : horizontal line center to right
2 : vertical line center to bottom
4 : horizontal line center to left
8 : vertical line center to top


A square of any size must have 


4 in all cells except the first in top and bottom row
1 in all cells except the last in top and bottom row
8 in all cells except the first in leftmost and rightmost column
2 in all cells except the last in leftmost and rightmost column


Test



f=(h,z)=&gt;(o=&gt;{r=p=&gt;" ),┌(─┐┬'└│├┘┴┤┼".search(z[p]);k=(p,d,m)=&gt;r(p)&amp;r(p+s*d)&amp;m;for(q=s=0;++s&lt;o/2&amp;s&lt;h;)for(y=0;y&lt;(h-s)*o;y+=o)for(x=0;x&lt;o-s*2;q+=!n,x+=2)for(n=i=0,t=x,u=y;i&lt;=s;t+=2,u+=o,i++)n=n|i&lt;s&amp;(!k(t+y,o,1)|!k(x+u,2,2))|i&gt;0&amp;(!k(t+y,o,4)|!k(x+u,2,8));})(-~z.search`
`)|q

console.log=(...x)=&gt;O.textContent+=x+'\n'

// Less golfed

Uf=(h,z)=&gt;{
  o=-~z.search`\n`;
  w=o/2;
  r=p=&gt;" ),┌(─┐┬'└│├┘┴┤┼".search(z[p]);
  k=(p,d,m)=&gt;r(p)&amp;r(p+s*d)&amp;m;
  for(q=s=0;++s&lt;w&amp;s&lt;h;)
    for(y=0;y&lt;(h-s)*o;y+=o)
      for(x=0;x&lt;(w-s)*2;q+=!n,x+=2)
        for(n=i=0,t=x,u=y;i&lt;=s;t+=2,u+=o,i++)
          n|=i&lt;s&amp;(!k(t+y,o,1)|!k(x+u,2,2))
          |i&gt;0&amp;(!k(t+y,o,4)|!k(x+u,2,8));
  return q
}

;[[5,`┌─┬───┬─┐
├─┼─┬─┼─┤
├─┼─┴─┼─┤
├─┼─┬─┼─┤
└─┴─┴─┴─┘`,20]
,[5,`┌─┬─┬─┬─┐
├─┼─┼─┼─┤
├─┼─┼─┼─┤
├─┼─┼─┼─┤
└─┴─┴─┴─┘`,30]
,[3,`┌─┬─┐
├─┼─┤
└─┴─┘`,5]
,[5,`┌─┬─┐
├─┴─┤
├───┤
├─┬─┤
└─┴─┘`,7]
,[4,`┌─┬─┬─┬─┬─┬─┐
├─┼─┼─┼─┼─┼─┤
├─┼─┼─┼─┼─┼─┤
└─┴─┴─┴─┴─┴─┘`,32]
,[2,`┌─┐
└─┘`,1]
,[4,`┌─┬─┬─┬─┬─┬─┐
├─┴─┼─┼─┼─┴─┤
├─┬─┼─┼─┼─┬─┤
└─┴─┴─┴─┴─┴─┘`,22],
,[6,`┌─┬─────┐
├─┼─┬─┐ │
│ ├─┼─┼─┤
│ └─┼─┼─┤
│   └─┼─┤
└─────┴─┘`,12],  
,[6,`┌─┬─┬─┬─┐
├─┴─┼─┼─┤
│   └─┼─┤
├─┬─┬─┼─┤
├─┼─┼─┼─┤
└─┴─┴─┴─┘`,23]]  
.forEach(t=&gt;{
  var r=t[0],a=t[1],k=t[2],x=f(r,a)
  console.log(x==k?'OK '+x:'KO '+x+' Expected '+k,'\n'+a)
})
&lt;pre id=O&gt;&lt;/pre&gt;